{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "\n",
    "import sys\n",
    "sys.path.append(\"..\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now, iText2KG is compatible with all language models supported by LangChain. \n",
    "\n",
    "To use iText2KG, you will need both a chat model and an embeddings model. \n",
    "\n",
    "For available chat models, refer to the options listed at: https://python.langchain.com/v0.2/docs/integrations/chat/. \n",
    "For embedding models, explore the choices at: https://python.langchain.com/v0.2/docs/integrations/text_embedding/. \n",
    "\n",
    "This notebook will show you how to run iText2KG using Mistral, Ollama, and OpenAI models. \n",
    "\n",
    "**Please ensure that you install the necessary package for each chat model before use.**"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Mistral"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For Mistral, please set up your model using the tutorial here: https://python.langchain.com/v0.2/docs/integrations/chat/mistralai/. Similarly, for the embedding model, follow the setup guide here: https://python.langchain.com/v0.2/docs/integrations/text_embedding/mistralai/ ."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain_mistralai import ChatMistralAI\n",
    "from langchain_mistralai import MistralAIEmbeddings\n",
    "\n",
    "mistral_api_key = \"##\"\n",
    "mistral_llm_model = ChatMistralAI(\n",
    "    api_key = mistral_api_key,\n",
    "    model=\"mistral-large-latest\",\n",
    "    temperature=0,\n",
    "    max_retries=2,\n",
    ")\n",
    "\n",
    "\n",
    "mistral_embeddings_model = MistralAIEmbeddings(\n",
    "    model=\"mistral-embed\",\n",
    "    api_key = mistral_api_key\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# OpenAI"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The same applies for OpenAI. \n",
    "\n",
    "please setup your model using the tutorial : https://python.langchain.com/v0.2/docs/integrations/chat/openai/\n",
    "The same for embedding model : https://python.langchain.com/v0.2/docs/integrations/text_embedding/openai/"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain_openai import ChatOpenAI, OpenAIEmbeddings\n",
    "\n",
    "openai_api_key = \"##\"\n",
    "\n",
    "openai_llm_model = llm = ChatOpenAI(\n",
    "    api_key = openai_api_key,\n",
    "    model=\"gpt-4o\",\n",
    "    temperature=0,\n",
    "    max_tokens=None,\n",
    "    timeout=None,\n",
    "    max_retries=2,\n",
    ")\n",
    "\n",
    "openai_embeddings_model = OpenAIEmbeddings(\n",
    "    api_key = openai_api_key ,\n",
    "    model=\"text-embedding-3-large\",\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Ollama"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The same applies for Ollama. \n",
    "\n",
    "please setup your model using the tutorial : https://python.langchain.com/v0.2/docs/integrations/chat/ollama/\n",
    "The same for embedding model : https://python.langchain.com/v0.2/docs/integrations/text_embedding/openai/"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain_ollama import ChatOllama, OllamaEmbeddings\n",
    "\n",
    "llm = ChatOllama(\n",
    "    model=\"llama3\",\n",
    "    temperature=0,\n",
    ")\n",
    "\n",
    "embeddings = OllamaEmbeddings(\n",
    "    model=\"llama3\",\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# iText2KG"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* Use Case: We aim to connect an online job description with a generated CV using Knowledge Graphs. \n",
    "\n",
    "* The objective is to assess the candidate's suitability for the job offer. You can utilize different LLM or embedding models for each module of iText2KG. However, it is important to ensure that the dimensions of node and relation embeddings are consistent across models. If the embedding dimensions differ, cosine similarity may struggle to accurately measure vector distances for further matching."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Document Distiller"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### CV"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain.document_loaders import PyPDFLoader\n",
    "\n",
    "loader = PyPDFLoader(f\"../datasets/cvs/CV_Emily_Davis.pdf\")\n",
    "pages = loader.load_and_split()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from itext2kg.documents_distiller import DocumentsDistiller, CV\n",
    "\n",
    "\n",
    "document_distiller = DocumentsDistiller(llm_model = openai_llm_model)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "IE_query = '''\n",
    "# DIRECTIVES : \n",
    "- Act like an experienced information extractor. \n",
    "- You have a chunk of a CV.\n",
    "- If you do not find the right information, keep its place empty.\n",
    "'''\n",
    "# we have replaced the curly braces with square brackets to avoid the error in the query\n",
    "distilled_cv = document_distiller.distill(documents=[page.page_content.replace(\"{\", '[').replace(\"}\", \"]\") for page in pages], IE_query=IE_query, output_data_structure=CV)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "semantic_blocks_cv = [f\"{key} - {value}\".replace(\"{\", \"[\").replace(\"}\", \"]\") for key, value in distilled_cv.items() if value !=[] and value != \"\"  and value is not None]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Job description"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "job_offer = \"\"\" \n",
    "About the Job Offer\n",
    "THE FICTITIOUS COMPANY\n",
    "\n",
    "FICTITIOUS COMPANY is a high-end French fashion brand known for its graphic and poetic style, driven by the values of authenticity and transparency upheld by its creator Simon Porte Jacquemus.\n",
    "\n",
    "Your Role\n",
    "\n",
    "Craft visual stories that captivate, inform, and inspire. Transform concepts and ideas into visual representations. As a member of the studio, in collaboration with the designers and under the direction of the Creative Designer, you should be able to take written or spoken ideas and convert them into designs that resonate. You need to have a deep understanding of the brand image and DNA, being able to find the style and layout suited to each project.\n",
    "\n",
    "Your Missions\n",
    "\n",
    "Translate creative direction into high-quality silhouettes using Photoshop\n",
    "Work on a wide range of projects to visualize and develop graphic designs that meet each brief\n",
    "Work independently as well as in collaboration with the studio team to meet deadlines, potentially handling five or more projects simultaneously\n",
    "Develop color schemes and renderings in Photoshop, categorized by themes, subjects, etc.\n",
    "Your Profile\n",
    "\n",
    "Bachelor’s degree (Bac+3/5) in Graphic Design or Art\n",
    "3 years of experience in similar roles within a luxury brand's studio\n",
    "Proficiency in Adobe Suite, including Illustrator, InDesign, Photoshop\n",
    "Excellent communication and presentation skills\n",
    "Strong organizational and time management skills to meet deadlines in a fast-paced environment\n",
    "Good understanding of the design process\n",
    "Freelance contract possibility\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "job_offer_2 = \"\"\" \n",
    "About the Job Offer\n",
    "About The Role\n",
    "\n",
    "Innovate Design Co. is seeking a talented Visual Designer with expertise in web and interactive design to enhance our visual brand identity. This role is responsible for external digital storytelling and communications design.\n",
    "\n",
    "You'll be in charge of designing and developing engaging web pages, infographics, social media content, and global digital experiences that effectively convey our cutting-edge technology and products to diverse audiences.\n",
    "\n",
    "Responsibilities\n",
    "\n",
    "Translate our core values, product, marketing, and sales objectives into beautifully crafted deliverables\n",
    "Design compelling, brand-aligned digital and print materials, including websites, social media content, ads, third-party marketplaces, presentations, animations, events, prints, etc.\n",
    "Develop and maintain visual brand identity guidelines, ensuring brand consistency across all media and multichannel platforms\n",
    "Communicate Innovate Design Co.'s narrative through conversion and data-driven design\n",
    "Participate in brainstorming sessions and collaborate with stakeholders to articulate a creative vision that enhances our brand’s visual storytelling\n",
    "Promote design comprehension and sensibility across the organization, refining work methodologies and design processes to enhance efficiency and effectiveness\n",
    "Required Qualifications\n",
    "\n",
    "A Bachelor’s degree (or equivalent) in Graphic Design / Visual Arts - or a self-starter with a strong creative project track record\n",
    "5-7 years of experience in Graphic Design, including brand design, 360° marketing and communications design, product brand design, 0-to-1 projects, front-end development, etc.\n",
    "Work experience within well-structured design departments operating in the tech/software space (including leading creative agencies, scale-ups, and mature tech companies)\n",
    "Proficiency in Figma, Adobe CC, print design best practices, and a solid understanding of web technologies (HTML, CSS, JS)\n",
    "A robust portfolio demonstrating a variety of design projects, showcasing creativity, originality, consistency, and attention to detail\n",
    "Perfectly fluent in English, both written and spoken\n",
    "Results-oriented, resourceful, innovative, intellectually curious, no-ego, proactive\n",
    "Highly collaborative and able to balance multiple projects and stakeholders\n",
    "Professional behavior with personal accountability, drive, and work ethics\n",
    "You may be a good fit if you\n",
    "\n",
    "Share our excitement for the AI/technology space\n",
    "Drive projects independently, make judgments based on brand and business goals, seek feedback, collaborate cross-functionally, and leverage others' expertise\n",
    "Maintain high design standards without perfectionism, understanding tradeoffs in a fast-paced environment\n",
    "Understand audience feelings, cultures, and challenges through an inquisitive and learning-based approach\n",
    "What We Offer\n",
    "\n",
    "The ability to shape the exciting journey of technology and be part of the very early days of one of Europe’s hottest startups\n",
    "A fun, young, international, and multicultural team — based in Paris, London, and San Francisco\n",
    "Beautiful office space in the heart of Paris (Canal St Martin)\n",
    "Competitive salary and benefits package\n",
    "Opportunities for professional growth and development\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pydantic import BaseModel, Field\n",
    "from typing import List, Optional\n",
    "\n",
    "class JobResponsibility(BaseModel):\n",
    "    description: str = Field(..., description=\"A specific responsibility in the job role\")\n",
    "\n",
    "class JobQualification(BaseModel):\n",
    "    skill: str = Field(..., description=\"A required or preferred skill for the job\")\n",
    "\n",
    "class JobCertification(BaseModel):\n",
    "    certification: str = Field(..., description=\"Required or preferred certifications for the job\")\n",
    "\n",
    "class JobOffer(BaseModel):\n",
    "    job_offer_title: str = Field(..., description=\"The job title\")\n",
    "    company: str = Field(..., description=\"The name of the company offering the job\")\n",
    "    location: str = Field(..., description=\"The job location (can specify if remote/hybrid)\")\n",
    "    job_type: str = Field(..., description=\"Type of job (e.g., full-time, part-time, contract)\")\n",
    "    responsibilities: List[JobResponsibility] = Field(..., description=\"List of key responsibilities\")\n",
    "    qualifications: List[JobQualification] = Field(..., description=\"List of required or preferred qualifications\")\n",
    "    certifications: Optional[List[JobCertification]] = Field(None, description=\"Required or preferred certifications\")\n",
    "    benefits: Optional[List[str]] = Field(None, description=\"List of job benefits\")\n",
    "    experience_required: str = Field(..., description=\"Required years of experience\")\n",
    "    salary_range: Optional[str] = Field(None, description=\"Salary range for the position\")\n",
    "    apply_url: Optional[str] = Field(None, description=\"URL to apply for the job\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "IE_query = '''\n",
    "# DIRECTIVES : \n",
    "- Act like an experienced information extractor. \n",
    "- You have a chunk of a job offer description.\n",
    "- If you do not find the right information, keep its place empty.\n",
    "'''\n",
    "# we have replaced the curly braces with square brackets to avoid the error in the query\n",
    "distilled_Job_Offer = document_distiller.distill(documents=[job_offer], IE_query=IE_query, output_data_structure=JobOffer)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "semantic_blocks_job_offer = [f\"{key} - {value}\".replace(\"{\", \"[\").replace(\"}\", \"]\") for key, value in distilled_Job_Offer.items() if value !=[] and value != \"\"  and value is not None]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "distilled_Job_Offer_2 = document_distiller.distill(documents=[job_offer_2], IE_query=IE_query, output_data_structure=JobOffer)\n",
    "semantic_blocks_job_offer_2 = [f\"{key} - {value}\".replace(\"{\", \"[\").replace(\"}\", \"]\") for key, value in distilled_Job_Offer_2.items() if value !=[] and value != \"\"  and value is not None]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## iText2KG for graph construction"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "from itext2kg import iText2KG\n",
    "\n",
    "\n",
    "itext2kg = iText2KG(llm_model = openai_llm_model, embeddings_model = openai_embeddings_model)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We constructed the first graph. As you can see, we have passed all the semantic blocks of the CV to the LLM as one block. You can also pass the job offer as another semantic block, or you can separate the semantic blocks while constructing the graph.\n",
    "\n",
    "You just need to pay attention to how much information is contained within each block. For example, the block \"name - Emily Davis\" does not contain much information, which will result in some isolated nodes (even if we reprompt it, it won't converge). It is better to concatenate it with other blocks or pass all the semantic blocks at once as we did here :) .\n",
    "\n",
    "You should also ensure that you pass a substantial amount of information within each block. If there is a lot of information, you will have a well-formed graph. However, the nodes may contain merged concepts (phrases from paragraphs).\n",
    "\n",
    "You need to find the optimal amount of information to include (you can experiment by iterating)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[INFO] ------- Extracting Entities from the Document 1\n",
      "{'entities': [{'label': 'Person', 'name': 'Emily Davis'}, {'label': 'Contact Information', 'name': '+1 567 890 1234'}, {'label': 'Contact Information', 'name': 'emilydavis@example.com'}, {'label': 'Social Media', 'name': 'linkedin.com/in/emilydavis'}, {'label': 'Profession', 'name': 'Graphic Designer'}, {'label': 'Company', 'name': 'MNO Creative'}, {'label': 'Location', 'name': 'Boston, MA'}, {'label': 'Education', 'name': 'Bachelor of Fine Arts in Graphic Design'}, {'label': 'Institution', 'name': 'Rhode Island School of Design'}, {'label': 'Skill', 'name': 'Adobe Creative Suite'}, {'label': 'Skill', 'name': 'Sketch'}, {'label': 'Skill', 'name': 'Figma'}, {'label': 'Skill', 'name': 'Creativity'}, {'label': 'Skill', 'name': 'Communication'}, {'label': 'Skill', 'name': 'Time Management'}, {'label': 'Certification', 'name': 'Adobe Certified Expert'}, {'label': 'Certification', 'name': 'UX Design Certification by Nielsen Norman Group'}]}\n",
      "[INFO] ------- Extracting Relations from the Document 1\n",
      "{'relationships': [{'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': '+1 567 890 1234', 'label': 'Contact_Information'}, 'name': 'has_contact_information'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'emilydavis@example.com', 'label': 'Contact_Information'}, 'name': 'has_contact_information'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'linkedin.com/in/emilydavis', 'label': 'Social_Media'}, 'name': 'has_social_media'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'graphic designer', 'label': 'Profession'}, 'name': 'has_profession'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'Bachelor of Fine Arts in Graphic Design', 'label': 'Education'}, 'name': 'has_education'}, {'startNode': {'name': 'Bachelor of Fine Arts in Graphic Design', 'label': 'Education'}, 'endNode': {'name': 'Rhode Island School of Design', 'label': 'Institution'}, 'name': 'awarded_by'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'MNO Creative', 'label': 'Company'}, 'name': 'works_at'}, {'startNode': {'name': 'MNO Creative', 'label': 'Company'}, 'endNode': {'name': 'Boston, MA', 'label': 'Location'}, 'name': 'located_in'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'Adobe Certified Expert', 'label': 'Certification'}, 'name': 'holds_certification'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'UX Design Certification by Nielsen Norman Group', 'label': 'Certification'}, 'name': 'holds_certification'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'Adobe Creative Suite', 'label': 'Skill'}, 'name': 'has_skill'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'Sketch', 'label': 'Skill'}, 'name': 'has_skill'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'Figma', 'label': 'Skill'}, 'name': 'has_skill'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'Creativity', 'label': 'Skill'}, 'name': 'has_skill'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'Communication', 'label': 'Skill'}, 'name': 'has_skill'}, {'startNode': {'name': 'Emily Davis', 'label': 'Person'}, 'endNode': {'name': 'Time Management', 'label': 'Skill'}, 'name': 'has_skill'}]}\n",
      "[INFO] Verification of invented entities\n"
     ]
    }
   ],
   "source": [
    "kg = itext2kg.build_graph(sections=[semantic_blocks_cv], ent_threshold=0.6, rel_threshold=0.6)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We construct the second graph of the job offers, noting that we already have existing entities and relationships (of the CV)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[INFO] ------- Extracting Entities from the Document 1\n",
      "{'entities': [{'label': 'Company', 'name': 'FICTITIOUS COMPANY'}, {'label': 'Job Type', 'name': 'Freelance'}, {'label': 'Responsibility', 'name': 'Craft visual stories that captivate, inform, and inspire.'}, {'label': 'Responsibility', 'name': 'Transform concepts and ideas into visual representations.'}, {'label': 'Responsibility', 'name': 'Translate creative direction into high-quality silhouettes using Photoshop.'}, {'label': 'Responsibility', 'name': 'Work on a wide range of projects to visualize and develop graphic designs that meet each brief.'}, {'label': 'Responsibility', 'name': 'Work independently as well as in collaboration with the studio team to meet deadlines, potentially handling five or more projects simultaneously.'}, {'label': 'Responsibility', 'name': 'Develop color schemes and renderings in Photoshop, categorized by themes, subjects, etc.'}, {'label': 'Qualification', 'name': 'Bachelor’s degree (Bac+3/5) in Graphic Design or Art'}, {'label': 'Qualification', 'name': \"3 years of experience in similar roles within a luxury brand's studio\"}, {'label': 'Qualification', 'name': 'Proficiency in Adobe Suite, including Illustrator, InDesign, Photoshop'}, {'label': 'Qualification', 'name': 'Excellent communication and presentation skills'}, {'label': 'Qualification', 'name': 'Strong organizational and time management skills to meet deadlines in a fast-paced environment'}, {'label': 'Qualification', 'name': 'Good understanding of the design process'}, {'label': 'Experience Required', 'name': '3 years'}]}\n",
      "[INFO] ------- Extracting Relations from the Document 1\n",
      "{'relationships': [{'startNode': {'name': 'fictitious company', 'label': 'Company'}, 'endNode': {'name': 'freelance', 'label': 'Job_Type'}, 'name': 'offers'}, {'startNode': {'name': '3 years', 'label': 'Experience_Required'}, 'endNode': {'name': \"3 years of experience in similar roles within a luxury brand's studio\", 'label': 'Qualification'}, 'name': 'matches'}, {'startNode': {'name': 'bachelor’s degree (bac+3/5) in graphic design or art', 'label': 'Qualification'}, 'endNode': {'name': 'proficiency in adobe suite, including illustrator, indesign, photoshop', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'excellent communication and presentation skills', 'label': 'Qualification'}, 'endNode': {'name': 'strong organizational and time management skills to meet deadlines in a fast paced environment', 'label': 'Qualification'}, 'name': 'complements'}, {'startNode': {'name': 'craft visual stories that captivate, inform, and inspire.', 'label': 'Responsibility'}, 'endNode': {'name': 'transform concepts and ideas into visual representations.', 'label': 'Responsibility'}, 'name': 'supports'}, {'startNode': {'name': 'translate creative direction into high quality silhouettes using photoshop.', 'label': 'Responsibility'}, 'endNode': {'name': 'develop color schemes and renderings in photoshop, categorized by themes, subjects, etc.', 'label': 'Responsibility'}, 'name': 'involves'}, {'startNode': {'name': 'work independently as well as in collaboration with the studio team to meet deadlines, potentially handling five or more projects simultaneously.', 'label': 'Responsibility'}, 'endNode': {'name': 'work on a wide range of projects to visualize and develop graphic designs that meet each brief.', 'label': 'Responsibility'}, 'name': 'enables'}]}\n",
      "[INFO] Verification of invented entities\n",
      "[INFO][ISOLATED ENTITIES][TRY-1] Aie; there are some isolated entities without relations [Entity(name=good understanding of the design process, label=Qualification, properties=embeddings=array([ 0.01386523,  0.01255891, -0.01025877, ..., -0.0073396 ,\n",
      "        0.00353911, -0.00739175]))]. Solving them ...\n",
      "{'relationships': []}\n",
      "[INFO] Verification of invented entities\n",
      "[INFO][ISOLATED ENTITIES][TRY-2] Aie; there are some isolated entities without relations [Entity(name=fictitious company, label=Company, properties=embeddings=array([ 0.01315606,  0.0135165 , -0.01351676, ..., -0.0088553 ,\n",
      "       -0.02344764,  0.00961048])), Entity(name=excellent communication and presentation skills, label=Qualification, properties=embeddings=array([-0.0019484 ,  0.00113083, -0.00679974, ..., -0.00657616,\n",
      "        0.01330744, -0.00398499])), Entity(name=3 years, label=Experience_Required, properties=embeddings=array([-0.02497637, -0.00176995, -0.00470387, ...,  0.00137732,\n",
      "        0.01496493,  0.00609627])), Entity(name=translate creative direction into high quality silhouettes using photoshop., label=Responsibility, properties=embeddings=array([-0.02831417, -0.04174525, -0.01603956, ..., -0.01997902,\n",
      "       -0.00757193, -0.00271449])), Entity(name=work independently as well as in collaboration with the studio team to meet deadlines, potentially handling five or more projects simultaneously., label=Responsibility, properties=embeddings=array([-0.02746955, -0.01515483, -0.01472321, ..., -0.01739981,\n",
      "       -0.00489533,  0.00697052])), Entity(name=3 years of experience in similar roles within a luxury brand's studio, label=Qualification, properties=embeddings=array([-0.00818994, -0.00114462, -0.00838272, ..., -0.01573857,\n",
      "        0.00370041,  0.00215357])), Entity(name=freelance, label=Job_Type, properties=embeddings=array([-0.0149564 , -0.02170764, -0.01226949, ...,  0.00957608,\n",
      "       -0.01371369,  0.00227147])), Entity(name=develop color schemes and renderings in photoshop, categorized by themes, subjects, etc., label=Responsibility, properties=embeddings=array([-0.01875804, -0.02143247, -0.01977265, ..., -0.02328051,\n",
      "        0.00197541,  0.00958496])), Entity(name=bachelor’s degree (bac+3/5) in graphic design or art, label=Qualification, properties=embeddings=array([ 0.01252514,  0.01209915, -0.00840353, ..., -0.02355004,\n",
      "        0.0031483 ,  0.00336661])), Entity(name=proficiency in adobe suite, including illustrator, indesign, photoshop, label=Qualification, properties=embeddings=array([ 0.00830229, -0.00644555, -0.01801935, ..., -0.00344916,\n",
      "       -0.00804588,  0.00811016])), Entity(name=strong organizational and time management skills to meet deadlines in a fast paced environment, label=Qualification, properties=embeddings=array([-0.00148117, -0.01954139, -0.01058047, ..., -0.00104348,\n",
      "        0.00402175, -0.01688208])), Entity(name=good understanding of the design process, label=Qualification, properties=embeddings=array([ 0.01386523,  0.01255891, -0.01025877, ..., -0.0073396 ,\n",
      "        0.00353911, -0.00739175])), Entity(name=craft visual stories that captivate, inform, and inspire., label=Responsibility, properties=embeddings=array([-0.02075239, -0.00103991, -0.01649335, ..., -0.02782374,\n",
      "        0.00389139, -0.00744515])), Entity(name=transform concepts and ideas into visual representations., label=Responsibility, properties=embeddings=array([-0.01370829, -0.00747637, -0.01157827, ..., -0.02072646,\n",
      "        0.00370699, -0.0144107 ])), Entity(name=work on a wide range of projects to visualize and develop graphic designs that meet each brief., label=Responsibility, properties=embeddings=array([-0.01928815,  0.00242669, -0.01245821, ..., -0.02048994,\n",
      "       -0.00041299,  0.00829509]))]. Solving them ...\n",
      "{'relationships': [{'startNode': {'name': 'fictitious company', 'label': 'Company'}, 'endNode': {'name': 'freelance', 'label': 'Job_Type'}, 'name': 'offers'}, {'startNode': {'name': '3 years', 'label': 'Experience_Required'}, 'endNode': {'name': \"3 years of experience in similar roles within a luxury brand's studio\", 'label': 'Qualification'}, 'name': 'matches'}, {'startNode': {'name': 'bachelor’s degree (bac+3/5) in graphic design or art', 'label': 'Qualification'}, 'endNode': {'name': 'proficiency in adobe suite, including illustrator, indesign, photoshop', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'excellent communication and presentation skills', 'label': 'Qualification'}, 'endNode': {'name': 'strong organizational and time management skills to meet deadlines in a fast paced environment', 'label': 'Qualification'}, 'name': 'complements'}, {'startNode': {'name': 'craft visual stories that captivate, inform, and inspire.', 'label': 'Responsibility'}, 'endNode': {'name': 'transform concepts and ideas into visual representations.', 'label': 'Responsibility'}, 'name': 'supports'}, {'startNode': {'name': 'translate creative direction into high quality silhouettes using photoshop.', 'label': 'Responsibility'}, 'endNode': {'name': 'develop color schemes and renderings in photoshop, categorized by themes, subjects, etc.', 'label': 'Responsibility'}, 'name': 'involves'}, {'startNode': {'name': 'work independently as well as in collaboration with the studio team to meet deadlines, potentially handling five or more projects simultaneously.', 'label': 'Responsibility'}, 'endNode': {'name': 'work on a wide range of projects to visualize and develop graphic designs that meet each brief.', 'label': 'Responsibility'}, 'name': 'enables'}, {'startNode': {'name': 'good understanding of the design process', 'label': 'Qualification'}, 'endNode': {'name': 'proficiency in adobe suite, including illustrator, indesign, photoshop', 'label': 'Qualification'}, 'name': 'enhances'}]}\n",
      "[INFO] Verification of invented entities\n",
      "[INFO] Wohoo! Relation was matched --- [enhances] --merged --> [enables] \n",
      "[INFO] ------- Extracting Entities from the Document 2\n",
      "{'entities': [{'name': 'Visual Designer', 'label': 'Job Title'}, {'name': 'Innovate Design Co.', 'label': 'Company'}, {'name': 'Paris, London, and San Francisco', 'label': 'Location'}, {'name': 'Translate core values into deliverables', 'label': 'Responsibility'}, {'name': 'Design digital and print materials', 'label': 'Responsibility'}, {'name': 'Develop visual brand identity guidelines', 'label': 'Responsibility'}, {'name': 'Communicate narrative through design', 'label': 'Responsibility'}, {'name': 'Participate in brainstorming sessions', 'label': 'Responsibility'}, {'name': 'Promote design comprehension', 'label': 'Responsibility'}, {'name': 'Bachelor’s degree in Graphic Design / Visual Arts', 'label': 'Qualification'}, {'name': '5-7 years of experience in Graphic Design', 'label': 'Qualification'}, {'name': 'Work experience in tech/software design departments', 'label': 'Qualification'}, {'name': 'Proficiency in Figma, Adobe CC, web technologies', 'label': 'Qualification'}, {'name': 'Robust portfolio', 'label': 'Qualification'}, {'name': 'Fluent in English', 'label': 'Qualification'}, {'name': 'Results-oriented and innovative', 'label': 'Qualification'}, {'name': 'Highly collaborative', 'label': 'Qualification'}, {'name': 'Professional behavior', 'label': 'Qualification'}, {'name': 'Shape the journey of technology', 'label': 'Benefit'}, {'name': 'International and multicultural team', 'label': 'Benefit'}, {'name': 'Beautiful office space in Paris', 'label': 'Benefit'}, {'name': 'Competitive salary and benefits', 'label': 'Benefit'}, {'name': 'Opportunities for professional growth', 'label': 'Benefit'}]}\n",
      "[INFO] Wohoo! Entity was matched --- [innovate design co.:Company] --merged--> [fictitious company:Company]\n",
      "[INFO] Wohoo! Entity was matched --- [translate core values into deliverables:Responsibility] --merged--> [transform concepts and ideas into visual representations.:Responsibility]\n",
      "[INFO] Wohoo! Entity was matched --- [results oriented and innovative:Qualification] --merged--> [strong organizational and time management skills to meet deadlines in a fast paced environment:Qualification]\n",
      "[INFO] Wohoo! Entity was matched --- [professional behavior:Qualification] --merged--> [excellent communication and presentation skills:Qualification]\n",
      "[INFO] Wohoo! Entity was matched --- [communicate narrative through design:Responsibility] --merged--> [craft visual stories that captivate, inform, and inspire.:Responsibility]\n",
      "[INFO] Wohoo! Entity was matched --- [5 7 years of experience in graphic design:Qualification] --merged--> [3 years of experience in similar roles within a luxury brand's studio:Qualification]\n",
      "[INFO] Wohoo! Entity was matched --- [work experience in tech/software design departments:Qualification] --merged--> [3 years of experience in similar roles within a luxury brand's studio:Qualification]\n",
      "[INFO] Wohoo! Entity was matched --- [bachelor’s degree in graphic design / visual arts:Qualification] --merged--> [bachelor’s degree (bac+3/5) in graphic design or art:Qualification]\n",
      "[INFO] Wohoo! Entity was matched --- [participate in brainstorming sessions:Responsibility] --merged--> [work on a wide range of projects to visualize and develop graphic designs that meet each brief.:Responsibility]\n",
      "[INFO] Wohoo! Entity was matched --- [highly collaborative:Qualification] --merged--> [good understanding of the design process:Qualification]\n",
      "[INFO] Wohoo! Entity was matched --- [promote design comprehension:Responsibility] --merged--> [transform concepts and ideas into visual representations.:Responsibility]\n",
      "[INFO] Wohoo! Entity was matched --- [develop visual brand identity guidelines:Responsibility] --merged--> [work on a wide range of projects to visualize and develop graphic designs that meet each brief.:Responsibility]\n",
      "[INFO] Wohoo! Entity was matched --- [fluent in english:Qualification] --merged--> [excellent communication and presentation skills:Qualification]\n",
      "[INFO] Wohoo! Entity was matched --- [design digital and print materials:Responsibility] --merged--> [work on a wide range of projects to visualize and develop graphic designs that meet each brief.:Responsibility]\n",
      "[INFO] Wohoo! Entity was matched --- [proficiency in figma, adobe cc, web technologies:Qualification] --merged--> [proficiency in adobe suite, including illustrator, indesign, photoshop:Qualification]\n",
      "[INFO] ------- Extracting Relations from the Document 2\n",
      "{'relationships': [{'startNode': {'name': 'fictitious company', 'label': 'Company'}, 'endNode': {'name': 'visual designer', 'label': 'Job_Title'}, 'name': 'offers'}, {'startNode': {'name': 'visual designer', 'label': 'Job_Title'}, 'endNode': {'name': 'paris, london, and san francisco', 'label': 'Location'}, 'name': 'located_in'}, {'startNode': {'name': 'visual designer', 'label': 'Job_Title'}, 'endNode': {'name': 'transform concepts and ideas into visual representations.', 'label': 'Responsibility'}, 'name': 'responsible_for'}, {'startNode': {'name': 'visual designer', 'label': 'Job_Title'}, 'endNode': {'name': 'craft visual stories that captivate, inform, and inspire.', 'label': 'Responsibility'}, 'name': 'responsible_for'}, {'startNode': {'name': 'visual designer', 'label': 'Job_Title'}, 'endNode': {'name': 'work on a wide range of projects to visualize and develop graphic designs that meet each brief.', 'label': 'Responsibility'}, 'name': 'responsible_for'}, {'startNode': {'name': 'visual designer', 'label': 'Job_Title'}, 'endNode': {'name': 'strong organizational and time management skills to meet deadlines in a fast paced environment', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'visual designer', 'label': 'Job_Title'}, 'endNode': {'name': 'excellent communication and presentation skills', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'visual designer', 'label': 'Job_Title'}, 'endNode': {'name': 'robust portfolio', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'visual designer', 'label': 'Job_Title'}, 'endNode': {'name': 'bachelor’s degree (bac+3/5) in graphic design or art', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'visual designer', 'label': 'Job_Title'}, 'endNode': {'name': 'good understanding of the design process', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'visual designer', 'label': 'Job_Title'}, 'endNode': {'name': 'proficiency in adobe suite, including illustrator, indesign, photoshop', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'fictitious company', 'label': 'Company'}, 'endNode': {'name': 'beautiful office space in paris', 'label': 'Benefit'}, 'name': 'provides'}, {'startNode': {'name': 'fictitious company', 'label': 'Company'}, 'endNode': {'name': 'international and multicultural team', 'label': 'Benefit'}, 'name': 'provides'}, {'startNode': {'name': 'fictitious company', 'label': 'Company'}, 'endNode': {'name': 'shape the journey of technology', 'label': 'Benefit'}, 'name': 'provides'}, {'startNode': {'name': 'fictitious company', 'label': 'Company'}, 'endNode': {'name': 'competitive salary and benefits', 'label': 'Benefit'}, 'name': 'provides'}, {'startNode': {'name': 'fictitious company', 'label': 'Company'}, 'endNode': {'name': 'opportunities for professional growth', 'label': 'Benefit'}, 'name': 'provides'}]}\n",
      "[INFO] Verification of invented entities\n",
      "[INFO][ISOLATED ENTITIES][TRY-1] Aie; there are some isolated entities without relations [Entity(name=3 years of experience in similar roles within a luxury brand's studio, label=Qualification, properties=embeddings=array([-0.00818994, -0.00114462, -0.00838272, ..., -0.01573857,\n",
      "        0.00370041,  0.00215357])), Entity(name=3 years of experience in similar roles within a luxury brand's studio, label=Qualification, properties=embeddings=array([-0.00818994, -0.00114462, -0.00838272, ..., -0.01573857,\n",
      "        0.00370041,  0.00215357]))]. Solving them ...\n",
      "{'relationships': []}\n",
      "[INFO] Verification of invented entities\n",
      "[INFO][ISOLATED ENTITIES][TRY-2] Aie; there are some isolated entities without relations [Entity(name=fictitious company, label=Company, properties=embeddings=array([ 0.01315606,  0.0135165 , -0.01351676, ..., -0.0088553 ,\n",
      "       -0.02344764,  0.00961048])), Entity(name=transform concepts and ideas into visual representations., label=Responsibility, properties=embeddings=array([-0.01370829, -0.00747637, -0.01157827, ..., -0.02072646,\n",
      "        0.00370699, -0.0144107 ])), Entity(name=strong organizational and time management skills to meet deadlines in a fast paced environment, label=Qualification, properties=embeddings=array([-0.00148117, -0.01954139, -0.01058047, ..., -0.00104348,\n",
      "        0.00402175, -0.01688208])), Entity(name=visual designer, label=Job_Title, properties=embeddings=array([-0.01749011,  0.00052108, -0.01253675, ..., -0.00331216,\n",
      "        0.00282015, -0.01339323])), Entity(name=excellent communication and presentation skills, label=Qualification, properties=embeddings=array([-0.0019484 ,  0.00113083, -0.00679974, ..., -0.00657616,\n",
      "        0.01330744, -0.00398499])), Entity(name=craft visual stories that captivate, inform, and inspire., label=Responsibility, properties=embeddings=array([-0.02075239, -0.00103991, -0.01649335, ..., -0.02782374,\n",
      "        0.00389139, -0.00744515])), Entity(name=robust portfolio, label=Qualification, properties=embeddings=array([ 0.01172297,  0.0064328 , -0.01038448, ...,  0.00668491,\n",
      "       -0.00864818, -0.00800296])), Entity(name=paris, london, and san francisco, label=Location, properties=embeddings=array([-0.00289115,  0.0317418 , -0.01424807, ...,  0.01551356,\n",
      "       -0.00795499,  0.01588303])), Entity(name=3 years of experience in similar roles within a luxury brand's studio, label=Qualification, properties=embeddings=array([-0.00818994, -0.00114462, -0.00838272, ..., -0.01573857,\n",
      "        0.00370041,  0.00215357])), Entity(name=beautiful office space in paris, label=Benefit, properties=embeddings=array([-0.00252379,  0.02305365, -0.00660725, ...,  0.01035212,\n",
      "       -0.00385378, -0.00408481])), Entity(name=international and multicultural team, label=Benefit, properties=embeddings=array([-0.01386227,  0.01484713, -0.01704946, ..., -0.00237143,\n",
      "       -0.00501505,  0.00382758])), Entity(name=3 years of experience in similar roles within a luxury brand's studio, label=Qualification, properties=embeddings=array([-0.00818994, -0.00114462, -0.00838272, ..., -0.01573857,\n",
      "        0.00370041,  0.00215357])), Entity(name=bachelor’s degree (bac+3/5) in graphic design or art, label=Qualification, properties=embeddings=array([ 0.01252514,  0.01209915, -0.00840353, ..., -0.02355004,\n",
      "        0.0031483 ,  0.00336661])), Entity(name=work on a wide range of projects to visualize and develop graphic designs that meet each brief., label=Responsibility, properties=embeddings=array([-0.01928815,  0.00242669, -0.01245821, ..., -0.02048994,\n",
      "       -0.00041299,  0.00829509])), Entity(name=good understanding of the design process, label=Qualification, properties=embeddings=array([ 0.01386523,  0.01255891, -0.01025877, ..., -0.0073396 ,\n",
      "        0.00353911, -0.00739175])), Entity(name=shape the journey of technology, label=Benefit, properties=embeddings=array([-0.00724391,  0.01377169, -0.01293516, ..., -0.00357584,\n",
      "       -0.01456343, -0.00942548])), Entity(name=transform concepts and ideas into visual representations., label=Responsibility, properties=embeddings=array([-0.01370829, -0.00747637, -0.01157827, ..., -0.02072646,\n",
      "        0.00370699, -0.0144107 ])), Entity(name=competitive salary and benefits, label=Benefit, properties=embeddings=array([-0.01009598,  0.00330102, -0.01017854, ...,  0.01063482,\n",
      "       -0.01362168, -0.00228931])), Entity(name=work on a wide range of projects to visualize and develop graphic designs that meet each brief., label=Responsibility, properties=embeddings=array([-0.01928815,  0.00242669, -0.01245821, ..., -0.02048994,\n",
      "       -0.00041299,  0.00829509])), Entity(name=excellent communication and presentation skills, label=Qualification, properties=embeddings=array([-0.0019484 ,  0.00113083, -0.00679974, ..., -0.00657616,\n",
      "        0.01330744, -0.00398499])), Entity(name=work on a wide range of projects to visualize and develop graphic designs that meet each brief., label=Responsibility, properties=embeddings=array([-0.01928815,  0.00242669, -0.01245821, ..., -0.02048994,\n",
      "       -0.00041299,  0.00829509])), Entity(name=proficiency in adobe suite, including illustrator, indesign, photoshop, label=Qualification, properties=embeddings=array([ 0.00830229, -0.00644555, -0.01801935, ..., -0.00344916,\n",
      "       -0.00804588,  0.00811016])), Entity(name=opportunities for professional growth, label=Benefit, properties=embeddings=array([-0.02153001,  0.0218014 , -0.02362867, ...,  0.00241769,\n",
      "       -0.00850724, -0.00687735]))]. Solving them ...\n",
      "{'relationships': [{'startNode': {'name': 'Innovate Design Co.', 'label': 'Company'}, 'endNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'name': 'offers'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'Translate our core values, product, marketing, and sales objectives into beautifully crafted deliverables', 'label': 'Responsibility'}, 'name': 'has_responsibility'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'Design compelling, brand-aligned digital and print materials, including websites, social media content, ads, third-party marketplaces, presentations, animations, events, prints, etc.', 'label': 'Responsibility'}, 'name': 'has_responsibility'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'Develop and maintain visual brand identity guidelines, ensuring brand consistency across all media and multichannel platforms', 'label': 'Responsibility'}, 'name': 'has_responsibility'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': \"Communicate Innovate Design Co.'s narrative through conversion and data-driven design\", 'label': 'Responsibility'}, 'name': 'has_responsibility'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'Participate in brainstorming sessions and collaborate with stakeholders to articulate a creative vision that enhances our brand’s visual storytelling', 'label': 'Responsibility'}, 'name': 'has_responsibility'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'Promote design comprehension and sensibility across the organization, refining work methodologies and design processes to enhance efficiency and effectiveness', 'label': 'Responsibility'}, 'name': 'has_responsibility'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'A Bachelor’s degree (or equivalent) in Graphic Design / Visual Arts - or a self-starter with a strong creative project track record', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': '5-7 years of experience in Graphic Design, including brand design, 360° marketing and communications design, product brand design, 0-to-1 projects, front-end development, etc.', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'Work experience within well-structured design departments operating in the tech/software space (including leading creative agencies, scale-ups, and mature tech companies)', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'Proficiency in Figma, Adobe CC, print design best practices, and a solid understanding of web technologies (HTML, CSS, JS)', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'A robust portfolio demonstrating a variety of design projects, showcasing creativity, originality, consistency, and attention to detail', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'Perfectly fluent in English, both written and spoken', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'Results-oriented, resourceful, innovative, intellectually curious, no-ego, proactive', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'Highly collaborative and able to balance multiple projects and stakeholders', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'Visual Designer', 'label': 'Job_Title'}, 'endNode': {'name': 'Professional behavior with personal accountability, drive, and work ethics', 'label': 'Qualification'}, 'name': 'requires'}, {'startNode': {'name': 'Innovate Design Co.', 'label': 'Company'}, 'endNode': {'name': 'The ability to shape the exciting journey of technology and be part of the very early days of one of Europe’s hottest startups', 'label': 'Benefit'}, 'name': 'offers'}, {'startNode': {'name': 'Innovate Design Co.', 'label': 'Company'}, 'endNode': {'name': 'A fun, young, international, and multicultural team — based in Paris, London, and San Francisco', 'label': 'Benefit'}, 'name': 'offers'}, {'startNode': {'name': 'Innovate Design Co.', 'label': 'Company'}, 'endNode': {'name': 'Beautiful office space in the heart of Paris (Canal St Martin)', 'label': 'Benefit'}, 'name': 'offers'}, {'startNode': {'name': 'Innovate Design Co.', 'label': 'Company'}, 'endNode': {'name': 'Competitive salary and benefits package', 'label': 'Benefit'}, 'name': 'offers'}, {'startNode': {'name': 'Innovate Design Co.', 'label': 'Company'}, 'endNode': {'name': 'Opportunities for professional growth and development', 'label': 'Benefit'}, 'name': 'offers'}, {'startNode': {'name': 'Innovate Design Co.', 'label': 'Company'}, 'endNode': {'name': 'Paris, London, and San Francisco', 'label': 'Location'}, 'name': 'located_in'}]}\n",
      "[INFO] Verification of invented entities\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Company' name='innovate design co.' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [innovate design co.:Company] --merged--> [fictitious company:Company]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Responsibility' name='translate our core values, product, marketing, and sales objectives into beautifully crafted deliverables' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [translate our core values, product, marketing, and sales objectives into beautifully crafted deliverables:Responsibility] --merged--> [transform concepts and ideas into visual representations.:Responsibility]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Responsibility' name='design compelling, brand aligned digital and print materials, including websites, social media content, ads, third party marketplaces, presentations, animations, events, prints, etc.' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [design compelling, brand aligned digital and print materials, including websites, social media content, ads, third party marketplaces, presentations, animations, events, prints, etc.:Responsibility] --merged--> [work on a wide range of projects to visualize and develop graphic designs that meet each brief.:Responsibility]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Responsibility' name='develop and maintain visual brand identity guidelines, ensuring brand consistency across all media and multichannel platforms' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [develop and maintain visual brand identity guidelines, ensuring brand consistency across all media and multichannel platforms:Responsibility] --merged--> [work on a wide range of projects to visualize and develop graphic designs that meet each brief.:Responsibility]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Responsibility' name=\"communicate innovate design co.'s narrative through conversion and data driven design\" properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [communicate innovate design co.'s narrative through conversion and data driven design:Responsibility] --merged--> [craft visual stories that captivate, inform, and inspire.:Responsibility]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Responsibility' name='participate in brainstorming sessions and collaborate with stakeholders to articulate a creative vision that enhances our brand’s visual storytelling' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [participate in brainstorming sessions and collaborate with stakeholders to articulate a creative vision that enhances our brand’s visual storytelling:Responsibility] --merged--> [craft visual stories that captivate, inform, and inspire.:Responsibility]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Responsibility' name='promote design comprehension and sensibility across the organization, refining work methodologies and design processes to enhance efficiency and effectiveness' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [promote design comprehension and sensibility across the organization, refining work methodologies and design processes to enhance efficiency and effectiveness:Responsibility] --merged--> [work on a wide range of projects to visualize and develop graphic designs that meet each brief.:Responsibility]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Qualification' name='a bachelor’s degree (or equivalent) in graphic design / visual arts   or a self starter with a strong creative project track record' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [a bachelor’s degree (or equivalent) in graphic design / visual arts   or a self starter with a strong creative project track record:Qualification] --merged--> [bachelor’s degree (bac+3/5) in graphic design or art:Qualification]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Qualification' name='5 7 years of experience in graphic design, including brand design, 360° marketing and communications design, product brand design, 0 to 1 projects, front end development, etc.' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [5 7 years of experience in graphic design, including brand design, 360° marketing and communications design, product brand design, 0 to 1 projects, front end development, etc.:Qualification] --merged--> [3 years of experience in similar roles within a luxury brand's studio:Qualification]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Qualification' name='work experience within well structured design departments operating in the tech/software space (including leading creative agencies, scale ups, and mature tech companies)' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [work experience within well structured design departments operating in the tech/software space (including leading creative agencies, scale ups, and mature tech companies):Qualification] --merged--> [3 years of experience in similar roles within a luxury brand's studio:Qualification]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Qualification' name='proficiency in figma, adobe cc, print design best practices, and a solid understanding of web technologies (html, css, js)' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [proficiency in figma, adobe cc, print design best practices, and a solid understanding of web technologies (html, css, js):Qualification] --merged--> [proficiency in adobe suite, including illustrator, indesign, photoshop:Qualification]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Qualification' name='a robust portfolio demonstrating a variety of design projects, showcasing creativity, originality, consistency, and attention to detail' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [a robust portfolio demonstrating a variety of design projects, showcasing creativity, originality, consistency, and attention to detail:Qualification] --merged--> [robust portfolio:Qualification]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Qualification' name='perfectly fluent in english, both written and spoken' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [perfectly fluent in english, both written and spoken:Qualification] --merged--> [excellent communication and presentation skills:Qualification]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Qualification' name='results oriented, resourceful, innovative, intellectually curious, no ego, proactive' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [results oriented, resourceful, innovative, intellectually curious, no ego, proactive:Qualification] --merged--> [strong organizational and time management skills to meet deadlines in a fast paced environment:Qualification]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Qualification' name='highly collaborative and able to balance multiple projects and stakeholders' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [highly collaborative and able to balance multiple projects and stakeholders:Qualification] --merged--> [strong organizational and time management skills to meet deadlines in a fast paced environment:Qualification]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Qualification' name='professional behavior with personal accountability, drive, and work ethics' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [professional behavior with personal accountability, drive, and work ethics:Qualification] --merged--> [strong organizational and time management skills to meet deadlines in a fast paced environment:Qualification]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Company' name='innovate design co.' properties=EntityProperties(embeddings=None) and label='Benefit' name='the ability to shape the exciting journey of technology and be part of the very early days of one of europe’s hottest startups' properties=EntityProperties(embeddings=None) are invented. Solving them ...\n",
      "[INFO] Wohoo! Entity was matched --- [innovate design co.:Company] --merged--> [fictitious company:Company]\n",
      "[INFO] Wohoo! Entity was matched --- [the ability to shape the exciting journey of technology and be part of the very early days of one of europe’s hottest startups:Benefit] --merged--> [shape the journey of technology:Benefit]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Company' name='innovate design co.' properties=EntityProperties(embeddings=None) and label='Benefit' name='a fun, young, international, and multicultural team — based in paris, london, and san francisco' properties=EntityProperties(embeddings=None) are invented. Solving them ...\n",
      "[INFO] Wohoo! Entity was matched --- [innovate design co.:Company] --merged--> [fictitious company:Company]\n",
      "[INFO] Wohoo! Entity was matched --- [a fun, young, international, and multicultural team — based in paris, london, and san francisco:Benefit] --merged--> [international and multicultural team:Benefit]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Company' name='innovate design co.' properties=EntityProperties(embeddings=None) and label='Benefit' name='beautiful office space in the heart of paris (canal st martin)' properties=EntityProperties(embeddings=None) are invented. Solving them ...\n",
      "[INFO] Wohoo! Entity was matched --- [innovate design co.:Company] --merged--> [fictitious company:Company]\n",
      "[INFO] Wohoo! Entity was matched --- [beautiful office space in the heart of paris (canal st martin):Benefit] --merged--> [beautiful office space in paris:Benefit]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Company' name='innovate design co.' properties=EntityProperties(embeddings=None) and label='Benefit' name='competitive salary and benefits package' properties=EntityProperties(embeddings=None) are invented. Solving them ...\n",
      "[INFO] Wohoo! Entity was matched --- [innovate design co.:Company] --merged--> [fictitious company:Company]\n",
      "[INFO] Wohoo! Entity was matched --- [competitive salary and benefits package:Benefit] --merged--> [competitive salary and benefits:Benefit]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Company' name='innovate design co.' properties=EntityProperties(embeddings=None) and label='Benefit' name='opportunities for professional growth and development' properties=EntityProperties(embeddings=None) are invented. Solving them ...\n",
      "[INFO] Wohoo! Entity was matched --- [innovate design co.:Company] --merged--> [fictitious company:Company]\n",
      "[INFO] Wohoo! Entity was matched --- [opportunities for professional growth and development:Benefit] --merged--> [opportunities for professional growth:Benefit]\n",
      "[INFO][INVENTED ENTITIES] Aie; the entities label='Company' name='innovate design co.' properties=EntityProperties(embeddings=None) is invented. Solving it ...\n",
      "[INFO] Wohoo! Entity was matched --- [innovate design co.:Company] --merged--> [fictitious company:Company]\n",
      "[INFO] Wohoo! Relation was matched --- [has_responsibility] --merged --> [responsible_for] \n",
      "[INFO] Wohoo! Relation was matched --- [has_responsibility] --merged --> [responsible_for] \n",
      "[INFO] Wohoo! Relation was matched --- [has_responsibility] --merged --> [responsible_for] \n",
      "[INFO][ISOLATED ENTITIES][TRY-3] Aie; there are some isolated entities without relations [Entity(name=good understanding of the design process, label=Qualification, properties=embeddings=array([ 0.01386523,  0.01255891, -0.01025877, ..., -0.0073396 ,\n",
      "        0.00353911, -0.00739175]))]. Solving them ...\n",
      "{'relationships': []}\n",
      "[INFO] Verification of invented entities\n",
      "[INFO] ------- Matching the Document 1 Entities and Relationships with the Existing Global Entities/Relations\n",
      "[INFO] Wohoo! Entity was matched --- [visual designer:Job_Title] --merged--> [graphic designer:Profession]\n",
      "[INFO] Wohoo! Entity was matched --- [fictitious company:Company] --merged--> [mno creative:Company]\n",
      "[INFO] Wohoo! Entity was matched --- [proficiency in adobe suite, including illustrator, indesign, photoshop:Qualification] --merged--> [adobe creative suite:Skill]\n",
      "[INFO] Wohoo! Entity was matched --- [paris, london, and san francisco:Location] --merged--> [boston, ma:Location]\n",
      "[INFO] Wohoo! Entity was matched --- [bachelor’s degree (bac+3/5) in graphic design or art:Qualification] --merged--> [bachelor of fine arts in graphic design:Education]\n"
     ]
    }
   ],
   "source": [
    "kg_ = itext2kg.build_graph(sections=[semantic_blocks_job_offer, semantic_blocks_job_offer_2], existing_knowledge_graph=kg,  ent_threshold=0.6, rel_threshold=0.6)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Draw the graph\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The final section involves visualizing the constructed knowledge graph using GraphIntegrator. The graph database Neo4j is accessed using specified credentials, and the resulting graph is visualized to provide a visual representation of the relationships and entities extracted from the document."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "from itext2kg.graph_integration import GraphIntegrator\n",
    "\n",
    "\n",
    "URI = \"bolt://localhost:7687\"\n",
    "USERNAME = \"neo4j\"\n",
    "PASSWORD = \"##\"\n",
    "\n",
    "GraphIntegrator(uri=URI, username=USERNAME, password=PASSWORD).visualize_graph(knowledge_graph=kg_)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
